#!/usr/bin/env python

import gtk
from signals import encryptDialogSignals
import gettext

gettext.install('blendIT','locale');

class encryptDialog(gtk.Dialog):

   def __init__(self,blend,conv,wid):
      gtk.Dialog.__init__(self,_("Encrypt Message"),
                          blend.gui.chatWindow,
                          gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                          (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                           gtk.STOCK_OK, gtk.RESPONSE_ACCEPT));

      vbox = gtk.VBox();
      text = gtk.Label(_("To encrypt the message, please enter the password below."));
      text.show();
      self.entry = gtk.Entry();
      self.entry.show();
      self.entry.set_visibility(False);
      if conv.receiveEncryptKey is not None:
         self.samePasswordCheck = gtk.CheckButton(_("Use same password as your buddy"));
         self.samePasswordCheck.show();
         
      self.rememberKeyCheck = gtk.CheckButton(_("Remember password for future messages to this buddy"));
      self.rememberKeyCheck.show();
      vbox.pack_start(text,True,True);
      vbox.pack_start(self.entry);
      if conv.receiveEncryptKey is not None:
         vbox.pack_start(self.samePasswordCheck,False,False);
      else:
         self.samePasswordCheck = None;

      vbox.pack_start(self.rememberKeyCheck,False,False);
      vbox.set_spacing(8);
      vbox.show();

      self.vbox.pack_start(vbox,True,True,0);

      sigs = encryptDialogSignals.signals(blend);
      self.connect('response',sigs.on_response,conv,wid);
      def sig(widget): widget.destroy();
      self.connect('close',sig);
      self.set_border_width(4);
